<template>
  <div class="main-container">
    <div class="logo-wrapper"></div>
    <div class="card-container">
      <img class="loginFormImg" src="~@/assets/img/loginForm.png" />
      <div class="form-container">
        <div class="row">
          <a-input v-model="userName" placeholder="请输入账号" size="large">
            <a-icon slot="prefix" type="user" />
          </a-input>
        </div>
        <div class="row">
          <a-input
            v-model="password"
            placeholder="请输入密码"
            type="password"
            size="large"
          >
            <a-icon slot="prefix" type="lock" />
          </a-input>
        </div>
        <!-- <div class="row">
          <div class="login-assistance">
            <a-checkbox>管理员</a-checkbox>
            <a-checkbox>学员</a-checkbox>
          </div>
        </div> -->
        <div class="row">
          <a-button
            type="primary"
            class="full-width"
            size="large"
            @click="loginClick"
          >
            登录
          </a-button>
        </div>
      </div>
    </div>
  </div>
</template>
  
<script>
export default {
  data() {
    return {
      inputTabKey: "username",
      userName: "",
      password: "",
    };
  },
  methods: {
    loginClick() {
      this.$axios
        .post("/auth/login", {
          username: this.userName,
          password: this.password,
        })
        .then((res) => {
          localStorage.setItem("token",res.data.token);
          localStorage.setItem("userData", JSON.stringify(res.data));
          this.$store.commit('setUserData',res.data);
          location.href = "index.html";
        });
    },
  },
};
</script>
  
  <style lang="scss" scoped>
.main-container {
  padding-top: 80px;
  height: 100vh;
  background: url("~@/assets/img/bg.png");
  background-size: cover;
  background-repeat: no-repeat;
  position: relative;
  overflow: hidden;
}
.logo-wrapper {
  width: 1500px;
  text-align: center;
  background: url("~@/assets/img/loginTitle.png");
  background-repeat: no-repeat;
  background-size: 100%;
  margin: 0px auto;
  height: 78px;
  font-size: 60px;
  margin-bottom: 80px;
}
.card-container {
  width: 500px;
  height: 340px;
  text-align: center;
  background-color: transparent;
  border-radius: 4px;
  margin: 0 auto;
  top: 80px;
  position: relative;
  .loginFormImg {
    position: absolute;
    left: -280px;
    top: -280px;
  }
}
.ant-tabs .ant-tabs-top-bar {
  border-bottom: transparent;
  margin-bottom: 0;
}

.form-container {
  width: 500px;
  padding: 30px;
  .containerTop {
    height: 40px;
    line-height: 40px;
    font-size: 30px;
    color: #78d3f4;
    margin-bottom: 10px;
  }
}
.form-container .row {
  margin-bottom: 24px;
}
.login-assistance {
  display: flex;
  justify-content: space-around;
}
.full-width {
  width: 100%;
}
</style>
  <style lang="scss">
.main-container {
  .ant-input-affix-wrapper {
    .ant-input {
      border-radius: 0 !important;
      background: #19537e;
      color: white;
      border: 1px solid #126ca6;
    }
  }
  .ant-checkbox-wrapper {
    color: #78d3f4;
  }
}
</style>